﻿using System.Collections.Generic;

namespace PSE.Deployment.SetupBase
{
    public class WindowsServiceComparer : IEqualityComparer<Configuration.Actions.InstallWindowsService>
    {
        public bool Equals(Configuration.Actions.InstallWindowsService x, Configuration.Actions.InstallWindowsService y)
        {
            bool equal = true;

            for (int i = 0; i < x.Services.Count; i++)
            {
                if (x.Services[i].ServiceName != x.Services[i].ServiceName)
                    equal = false;
            }

            return equal;
        }

        public int GetHashCode(Configuration.Actions.InstallWindowsService obj)
        {
            return (obj.Id + obj.Name).GetHashCode();
        }
    }
}
